﻿#include "UIToolMenu.h"

#include "../Global/ECGGlobal.h"
#include "../Global/ResourcePath.h"
#include "../Global/ECGMessage.h"
#include "../Tools/clock.h"

#include <windows.h>

#pragma execution_character_set("utf-8")

UIToolMenu::UIToolMenu(QWidget *parent) :
    QCMultiMenu(parent)
{
	setMenuSize(28, 28);
    setHorizon(true);
    setShowBorder(true);

    addMenu(gProjectDir + gIconPath_HeartBeat);
	addMenu(gProjectDir + gIconPath_Ruler);
	addMenu(gProjectDir + gIconPath_Amplify);

	connect(m_vMenus[0], SIGNAL(clicked()), this, SLOT(onShowCurrentHeartBeat()));
	connect(m_vMenus[1], SIGNAL(clicked()), this, SLOT(onEnableRuler()));
	connect(m_vMenus[2], SIGNAL(clicked()), this, SLOT(onAmplify()));
    mainWnd = NULL;
	
}

UIToolMenu::~UIToolMenu()
{

}

void UIToolMenu::paintEvent(QPaintEvent *)
{

}

void UIToolMenu::mouseMoveEvent(QMouseEvent *event)
{
}

void UIToolMenu::mousePressEvent(QMouseEvent *event)
{

}

void UIToolMenu::mouseReleaseEvent(QMouseEvent *event)
{

}

void UIToolMenu::timerEvent(QTimerEvent *event)
{
}

void UIToolMenu::onShowCurrentHeartBeat()
{
	SendMessage((HWND)mainWnd->winId(), WM_MSG_SHOWCURRENTHEARTBEAT, NULL, NULL);
}

void UIToolMenu::onEnableRuler()
{
	SendMessage((HWND)mainWnd->winId(), WM_MSG_ENABLERULER, NULL, NULL);
}

void UIToolMenu::onAmplify()
{
	SendMessage((HWND)mainWnd->winId(), WM_MSG_AMPLIFY, NULL, NULL);
}

void UIToolMenu::setMainWnd(QWidget *pWnd)
{
    mainWnd = pWnd;
}
